import Vue from 'vue'
import iView from 'iview'
import App from './App.vue'
import router from './router'
import './plugins/iview.js'
// import $axios from './utils/axios'
import $storage from './utils/storage'
import $tools from './utils/tools'
import store from './store'

import PremissionView from './components/PremissionView.vue'

Vue.component('PremissionView', PremissionView)

Vue.config.productionTip = false

// Vue.prototype.$http = $axios
Vue.prototype.$storage = $storage
Vue.prototype.$mytools = $tools

router.beforeEach((to, from, next) => {
  // console.log(to, from)
  if (
    to.path === from.path &&
    to.query === from.query &&
    to.params === from.params
  ) {
    next(false)
    return
  }
  iView.LoadingBar.start()
  next()
})

router.afterEach((to, from) => {
  // console.log(to, from)
  iView.LoadingBar.finish()
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
